Skip to main content

15 Loading the module in Python code


15. Write Python programs Loading the module in Python code.

First Create a File Name With practical_15part2.py and write code as below.

def greeting(name):
print("Hello, " + name)

Now Create File Name With practical_15.py and write code as below.

import practical_15part2

practical_15part2.greeting("Milan")
Reference

A python module can be defined as a python program file which contains a python code including python functions, class, or variables. In other words, we can say that our python code file saved with the extension (.py) is treated as the module. We may have a runnable code inside the python module.

https://www.javatpoint.com/python-modules